package com.heima.user.controller;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.pojo.ApUser;
import com.heima.user.service.ApUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(path = "/api/v1/user")
public class ApUserController {

    @Resource
    private ApUserService apUserService;

    /**
     * 根据Id查询用户基础信息
     * @param userId
     * @return
     */
    @GetMapping(path = "/{id}")
    public ResponseResult findById(@PathVariable("id") Long userId) {
        ApUser apUser = apUserService.getById(userId);
        return ResponseResult.success(apUser);
    }
}
